package day16;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class mapPractice02 {
    public static void main(String[] args) {
        System.out.println("请输入要统计的内容:");
        String input=new Scanner(System.in).nextLine();
        Map<Character,Integer> map=new HashMap<>();
        for (int i = 0; i < input.length(); i++) {
            char key=input.charAt(i);
            Integer value=map.get(key);
            if (value==null){
                map.put(key,1);
            }else {
                map.put(key,value+1);
            }
        }
        System.out.println(map);
    }
}
